Re: [GENERAL] Problem with perl / postgres
От | Stuart Rison |
---|---|
Тема | Re: [GENERAL] Problem with perl / postgres |
Дата | |
Msg-id | v04020a00b38ead7a6764@[128.40.242.190] обсуждение исходный текст |
Ответ на | Problem with perl / postgres (Chris Bitmead <chris.bitmead@bigfoot.com>) |
Список | pgsql-general |
Hi Chris, I don't know why it works in psql but not in perl but I've had problems casting datetime as date before. In pg 6.4 the cast fails (and by that I mean it yields an error) if datetime is NULL. A possible 'workaround' is to double-cast: select date( abstime( dt ) ) from test1; Now because your query works in psql but not in perl, I don't think that casting of NULLs is likely to be the problem but hey, it's worth a shot. On a final note, I think datetime and date are reserved keywords so it's probably best to rename your attribute 'datetime' and your synonym 'date'! HTH, Stuart. >I've got this simple query... > >SELECT id, title, summary, datetime, datetime::date AS date FROM poll >WHERE id = ? > >which works from psql but fails with "bad parameter" from perl. If I >take out the "datetime::date AS date" bit it starts working. > >Why would a query work in psql but not perl? > >-- >Chris Bitmead >mailto:chris@tech.com.au >http://www.techphoto.org - Photography News, Stuff that Matters +-------------------------+--------------------------------------+ | Stuart Rison | Ludwig Institute for Cancer Research | +-------------------------+ 91 Riding House Street | | Tel. (0171) 878 4041 | London, W1P 8BT, UNITED KINGDOM. | | Fax. (0171) 878 4040 | stuart@ludwig.ucl.ac.uk | +-------------------------+--------------------------------------+
В списке pgsql-general по дате отправления: